<template>
    <!-- 柱状图 -->
    <div ref="echarts" style="height: 230px"></div>
</template>

<script>
import { getData } from "@/api/sys/user/user";
//引入echarts
import * as echarts from "echarts";
export default {
  mounted() {
    getData().then((response) => {
      //console.log(response);
      const myChart = echarts.init(this.$refs.echarts);
      const barOption = {
        legend: {
          // 图例文字颜色
          textStyle: {
            color: "#333",
          },
        },
        grid: {
          left: "20%",
        },
        // 提示框
        tooltip: {
          trigger: "axis",
        },
        xAxis: {
          type: "category", // 类目轴
          data: [],         //填写数据
          axisLine: {
            lineStyle: {
              color: "#17b3a3",
            },
          },
          axisLabel: {
            interval: 0,
            color: "#333",
          },
        },
        yAxis: [
          {
            type: "value",
            axisLine: {
              lineStyle: {
                color: "#17b3a3",
              },
            },
          },
        ],
        color: ["#2ec7c9", "#b6a2de"],
        series: [
          {
            type: "bar",
            name: "",     //填写自己的数据
            data: [],     //填写自己的数据
          },
          {
            type: "bar",
            name: "",    //填写自己的数据
            data: [],    //填写自己的数据
          },
        ],
      };
      myChart.setOption(barOption);
    });
  },
};
</script>

<style>
</style>
